package cn.hd01.repository.entity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

@Entity
@Table(name = "c_order")
@JsonInclude(Include.NON_NULL)
public class COrder {
	@Id
	@GeneratedValue
	private Integer id;
	
	@Column(nullable = false)
	private Integer distributorId;
	
	private String distributorName;
	
	@Transient
	private String distributorShopName;
	
	private String distributorPhoneNo;
	
	private Integer recommDistributorId;
	
	private String recommDistributorName;
	
	private String recommDistributorPhoneNo;
	
	@Column(nullable = false)
	private Integer customerId;
	
	private String customerName;
	
	private String customerPhoneNo;
	
	private Integer servantId;
	
	private String servantName;
	
	@Column(nullable = false)
	private BigDecimal amount;

	private BigDecimal servantRebate;
	
	private BigDecimal servantRebateRate;
	
	private BigDecimal distributorRebate;
	
	private BigDecimal distributorRebateRate;
	
	private BigDecimal recommDistributorRebate;
	
	private BigDecimal recommDistributorRebateRate;

	@Column(nullable = false)
	private String isBalance;
	
	private String projectName;
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@JsonFormat(pattern="yyyy-MM-dd")
	private Date createTime;
	
	private Date updateTime;
	
	@Transient
	private String beginDate;
	
	@Transient
	private String endDate;
	
	@Transient
	private BigDecimal leftAmount;
	
	@Transient
	private BigDecimal feeAmount;
	
	@Transient
	private BigDecimal receivedAmount;
	
	@Transient
	private List<Integer> distributorIdList;
	
	@Transient
	private String productName;
	
	@Transient
	private String productMsg;
	
	private String financeOrderNo;
	
	private String remark;
	
	@Transient
	private BigDecimal balanceAmount;
	
	@Transient
	private BigDecimal unBalanceAmount;
	
	@OneToOne(targetEntity = DistributorDetails.class)
	@JoinColumn(name="distributorId", referencedColumnName="distributorId", nullable=true, insertable=false, updatable=false)
	@NotFound(action=NotFoundAction.IGNORE)
	private DistributorDetails distributorDetails;
	
	@Transient
	private BigDecimal totalAmount;
	
	@Transient
	private String productNameAndCount;
	
	public String getProductNameAndCount() {
		return productNameAndCount;
	}

	public void setProductNameAndCount(String productNameAndCount) {
		this.productNameAndCount = productNameAndCount;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getDistributorId() {
		return distributorId;
	}

	public void setDistributorId(Integer distributorId) {
		this.distributorId = distributorId;
	}

	public String getDistributorName() {
		return distributorName;
	}

	public void setDistributorName(String distributorName) {
		this.distributorName = distributorName;
	}

	public Integer getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Integer customerId) {
		this.customerId = customerId;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public Integer getServantId() {
		return servantId;
	}

	public void setServantId(Integer servantId) {
		this.servantId = servantId;
	}

	public String getServantName() {
		return servantName;
	}

	public void setServantName(String servantName) {
		this.servantName = servantName;
	}

	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public BigDecimal getServantRebate() {
		return servantRebate;
	}

	public void setServantRebate(BigDecimal servantRebate) {
		this.servantRebate = servantRebate;
	}

	public BigDecimal getServantRebateRate() {
		return servantRebateRate;
	}

	public void setServantRebateRate(BigDecimal servantRebateRate) {
		this.servantRebateRate = servantRebateRate;
	}

	public BigDecimal getDistributorRebate() {
		return distributorRebate;
	}

	public void setDistributorRebate(BigDecimal distributorRebate) {
		this.distributorRebate = distributorRebate;
	}

	public BigDecimal getDistributorRebateRate() {
		return distributorRebateRate;
	}

	public void setDistributorRebateRate(BigDecimal distributorRebateRate) {
		this.distributorRebateRate = distributorRebateRate;
	}

	public String getIsBalance() {
		return isBalance;
	}

	public void setIsBalance(String isBalance) {
		this.isBalance = isBalance;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getDistributorPhoneNo() {
		return distributorPhoneNo;
	}

	public void setDistributorPhoneNo(String distributorPhoneNo) {
		this.distributorPhoneNo = distributorPhoneNo;
	}

	public String getCustomerPhoneNo() {
		return customerPhoneNo;
	}

	public void setCustomerPhoneNo(String customerPhoneNo) {
		this.customerPhoneNo = customerPhoneNo;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	
	public String getFinanceOrderNo() {
		return financeOrderNo;
	}

	public void setFinanceOrderNo(String financeOrderNo) {
		this.financeOrderNo = financeOrderNo;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getBeginDate() {
		return beginDate;
	}

	public void setBeginDate(String beginDate) {
		this.beginDate = beginDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public List<Integer> getDistributorIdList() {
		return distributorIdList;
	}

	public void setDistributorIdList(List<Integer> distributorIdList) {
		this.distributorIdList = distributorIdList;
	}

	public Integer getRecommDistributorId() {
		return recommDistributorId;
	}

	public void setRecommDistributorId(Integer recommDistributorId) {
		this.recommDistributorId = recommDistributorId;
	}

	public String getRecommDistributorName() {
		return recommDistributorName;
	}

	public void setRecommDistributorName(String recommDistributorName) {
		this.recommDistributorName = recommDistributorName;
	}

	public String getRecommDistributorPhoneNo() {
		return recommDistributorPhoneNo;
	}

	public void setRecommDistributorPhoneNo(String recommDistributorPhoneNo) {
		this.recommDistributorPhoneNo = recommDistributorPhoneNo;
	}

	public BigDecimal getRecommDistributorRebate() {
		return recommDistributorRebate;
	}

	public void setRecommDistributorRebate(BigDecimal recommDistributorRebate) {
		this.recommDistributorRebate = recommDistributorRebate;
	}

	public BigDecimal getRecommDistributorRebateRate() {
		return recommDistributorRebateRate;
	}

	public void setRecommDistributorRebateRate(
			BigDecimal recommDistributorRebateRate) {
		this.recommDistributorRebateRate = recommDistributorRebateRate;
	}

	public BigDecimal getLeftAmount() {
		return leftAmount;
	}

	public void setLeftAmount(BigDecimal leftAmount) {
		this.leftAmount = leftAmount;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public BigDecimal getReceivedAmount() {
		return receivedAmount;
	}

	public void setReceivedAmount(BigDecimal receivedAmount) {
		this.receivedAmount = receivedAmount;
	}

	public String getDistributorShopName() {
		return distributorShopName;
	}

	public void setDistributorShopName(String distributorShopName) {
		this.distributorShopName = distributorShopName;
	}

	public BigDecimal getFeeAmount() {
		return feeAmount;
	}

	public void setFeeAmount(BigDecimal feeAmount) {
		this.feeAmount = feeAmount;
	}

	public String getProductMsg() {
		return productMsg;
	}

	public void setProductMsg(String productMsg) {
		this.productMsg = productMsg;
	}

	public BigDecimal getBalanceAmount() {
		return balanceAmount;
	}

	public void setBalanceAmount(BigDecimal balanceAmount) {
		this.balanceAmount = balanceAmount;
	}

	public BigDecimal getUnBalanceAmount() {
		return unBalanceAmount;
	}

	public void setUnBalanceAmount(BigDecimal unBalanceAmount) {
		this.unBalanceAmount = unBalanceAmount;
	}

	public DistributorDetails getDistributorDetails() {
		return distributorDetails;
	}

	public void setDistributorDetails(DistributorDetails distributorDetails) {
		this.distributorDetails = distributorDetails;
	}

	public BigDecimal getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(BigDecimal totalAmount) {
		this.totalAmount = totalAmount;
	}
	
}